package org.atlantis.grosbeak.cable.boult;

import org.atlantis.grosbeak.cable.action.ActionBean;
import org.atlantis.grosbeak.depot.Boult;

/**
 * ActionBean的筛选器。
 * 
 * @author <a href="mailto:seenoevil.cn@gmail.com">SeeNoEvil</a>
 * 
 */
public class ActionBoult implements Boult {

	public boolean filter(Class<?> type) {
		return type.isAnnotationPresent(ActionBean.class);
	}

	public Object callback(Class<?> type) {
		String beanUrl = type.getAnnotation(ActionBean.class).value();
		if (beanUrl.equals(ActionBean.DEFAULT)) {
			beanUrl = type.getSimpleName();
		}
		return beanUrl;
	}
}
